package com.inspector.app.util;

import android.app.ActivityManager;
import android.content.Context;

import java.util.List;

public class ConvertHelper {

    public static boolean isServiceRunning(Context context, String serviceName) {
        ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
        List<ActivityManager.RunningServiceInfo> info = am.getRunningServices(200);
        if (info == null || info.isEmpty()) return false;
        for (ActivityManager.RunningServiceInfo serviceInfo : info) {
            if (serviceInfo.service.getClassName().equals(serviceName)) return true;
        }
        return false;
    }
}
